// 使用路由懒加载的方式加载组件
const Home = () => import('./home/Home.vue')
const Sort = () => import('./sort/Sort.vue')
const Surprised = () => import('./surprised/Surprised.vue')
const Cart = () => import('./cart/Cart.vue')
const User = () => import('./user/User.vue')
const Login = () => import('./user/Login.vue')
const Register = () => import('./user/Register.vue')
const GoodsDetail = () => import('./home/GoodsDetail.vue')
const AddressList = () => import('./home/AddressList.vue')
const NewAddress = () => import('./home/NewAddress.vue')

const routes = [
  {
    path: '/home',
    components: { alive: Home }
  },{
    path: '/sort',
    components: { alive: Sort }
  },{
    path: '/surprised',
    components: { alive: Surprised } 
  },{
    path: '/cart',
    components: { alive: Cart }, 
    meta: { isAuth: true }
  },{
    path: '/user',
    components: { alive: User }, 
    meta: { isAuth: true }
  },{
    path: '/login',
    component: Login
  },{
    path: '/register',
    component: Register
  },{
    path: '/goods/detail/:id',
    component: GoodsDetail
  },{
    path: '/addr/list',
    component: AddressList
  },{
    path: '/addr/add',
    component: NewAddress
  }
]

export default routes